<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>xiarikui管理后台</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link href="/Public/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/bootstrap/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/plugins/iCheck/flat/blue.css" rel="stylesheet" type="text/css" />
    <link href="/Public/Admin/css/unify.css" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon" href="/Public/images/favicon.ico" type="image/x-icon" />
    <script src="/Public/js/jQuery-2.1.4.min.js"></script>
    <script src="/Public/js/global.js"></script>
    <script src="/Public/js/myFormValidate.js"></script>
    <script src="/Public/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="/Public/js/layer/layer-min.js"></script>
    <script src="/Public/js/myAjax.js"></script>
    <script type="text/javascript">
    function delfunc(obj) {
        layer.confirm('确认删除？', {
            btn: ['确定', '取消']
        }, function() {
            $.ajax({
                type: 'post',
                url: $(obj).attr('data-url'),
                data: {
                    act: 'del',
                    del_id: $(obj).attr('data-id')
                },
                dataType: 'json',
                success: function(data) {
                    if (data == 1) {
                        layer.msg('操作成功', {
                            icon: 1
                        });
                        $(obj).parent().parent().remove();
                    } else {
                        layer.msg(data, {
                            icon: 2,
                            time: 2000
                        });
                    }
                    layer.closeAll();
                }
            });
        }, function(index) {
            layer.close(index);
            return false;
        });
    }

    //全选
    function selectAll(name, obj) {
        $('input[name*=' + name + ']').prop('checked', $(obj).checked);
    }

    function get_help(obj) {
        layer.open({
            type: 2,
            title: '',
            shadeClose: true,
            shade: 0.3,
            area: ['90%', '90%'],
            content: $(obj).attr('data-url')
        });
    }

    function delAll(obj, name) {
        var a = [];
        $('input[name*=' + name + ']').each(function(i, o) {
            if ($(o).is(':checked')) {
                a.push($(o).val());
            }
        });
        if (a.length == 0) {
            layer.alert('请选择删除项', {
                icon: 2
            });
            return;
        }
        layer.confirm('确认删除？', {
            btn: ['确定', '取消']
        }, function() {
            $.ajax({
                type: 'get',
                url: $(obj).attr('data-url'),
                data: {
                    act: 'del',
                    del_id: a
                },
                dataType: 'json',
                success: function(data) {
                    if (data == 1) {
                        layer.msg('操作成功', {
                            icon: 1
                        });
                        $('input[name*=' + name + ']').each(function(i, o) {
                            if ($(o).is(':checked')) {
                                $(o).parent().parent().remove();
                            }
                        });
                    } else {
                        layer.msg(data, {
                            icon: 2,
                            time: 2000
                        });
                    }
                    layer.closeAll();
                }
            });
        }, function(index) {
            layer.close(index);
            return false;
        });
    }
    </script>
    <style type="text/css">
        .table > thead:first-child > tr:first-child > th{
            border-bottom: 0 none;
        } 
    </style>
</head>

<body>

<script type="text/javascript">
    window.UEDITOR_Admin_URL = "/Public/plugins/Ueditor/";
    var URL_upload = "<?php echo ($URL_upload); ?>";
    var URL_fileUp = "<?php echo ($URL_fileUp); ?>";
    var URL_scrawlUp = "<?php echo ($URL_scrawlUp); ?>";
    var URL_getRemoteImage = "<?php echo ($URL_getRemoteImage); ?>";
    var URL_imageManager = "<?php echo ($URL_imageManager); ?>";
    var URL_imageUp = "<?php echo ($URL_imageUp); ?>";
    var URL_getMovie = "<?php echo ($URL_getMovie); ?>";
    var URL_home = "<?php echo ($URL_home); ?>";
</script>
<script type="text/javascript" src="/Public/plugins/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/Public/plugins/Ueditor/ueditor.all.js"></script>
<link href="/Public/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="/Public/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="/Public/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <div class="breadcrumbs" id="breadcrumbs">
    <ol class="breadcrumb">
        <?php if(is_array($navigate_admin)): foreach($navigate_admin as $k=>$v): ?><li><?php echo ($k); ?></li><?php endforeach; endif; ?>
    </ol>
</div>

    <section class="content">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default pull-right" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>图片信息</h3>
                </div>
                <div class="panel-body">
                    <form action="<?php echo U('banner/handle_banner');?>" method="post" onsubmit="return checkUserUpdate(this);">
                        <table class="table table-bordered">
                            <tbody>
                                <tr>
                                    <td class="col-sm-1 text-right">名称:</td>
                                    <td>
                                        <input type="text" class="form-control" name="name" value="<?php echo ($info["name"]); ?>">
                                    </td>
                                    <td></td>
                                </tr>


                                <tr>
                                    <td class="col-sm-1 text-right">排序:</td>
                                    <td>
                                        <input type="text" class="form-control" name="sort_order" value="<?php echo ($info["sort_order"]); ?>">
                                    </td>
                                    <td>数值小的，越靠前</td>
                                </tr>



                                <tr>
                                <td class = "text-right">是否显示:</td>
                                <td>
                            <input name="is_show" type="radio" value="1" <?php if($info['is_show'] == 1): ?>checked<?php endif; ?> >是
                            <input name="is_show" type="radio" value="0" <?php if($info['is_show'] == 0): ?>checked<?php endif; ?> >否
                            </td>
                            <td></td>
                            </tr>


                                <tr>
                                    <td class="col-sm-1 text-right">类型:</td>
                                    <td>
                                        <select name="type" class="form-control">
                                        <?php if(is_array($Type)): $i = 0; $__LIST__ = $Type;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if($key == $info[type]): ?>selected<?php endif; ?> ><?php echo ($vo); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </td>
                                    <td></td>
                                </tr>


                                <tr class="form-group">
                                    <td class="col-sm-1 text-right">banner图:</td>
                                    <td>
                                        <input type="text" id="imagetext" name="path" value="<?php echo ($info["path"]); ?>">
                                        <input type="button" class="button" onClick="GetUploadify(1, 'imagetext', 'banner', '')" value="上传图片" />
                                    <img src="<?php echo ($info["path"]); ?>" width="30" height="30"/></td>
                                </tr>


                            </table>
                            </tr>
                            <tr>
                                <td></td>
                                <td>
                                    <input type="hidden" value="<?php echo ($info["id"]); ?>" name="id" />
                                    <input type="hidden" value="<?php echo ($act); ?>" name="act" />
                                    <button type="submit" class="btn btn-info">
                                        <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                    </button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    function checkUserUpdate() {
//        var email = $('input[name="email"]').val();
        var cat_name = $('input[name="name"]').val();


        var error = '';

//    if (!checkEmail(email)) {
//        error += "邮箱地址有误\n";
//    }
        if (!cat_name) {
            error += "名称不允许空值\n";
        }
        if (error) {
            layer.alert(error, {
                icon: 2
            });
            return false;
        }
        return true;

    }



</script>
</body>

</html>